package com.meilele.dao.zhengchao;

import com.meilele.entity.zhengchao.FourContent;
import org.apache.ibatis.annotations.*;

public interface FourContentMapper {
    @Delete({
        "delete from four_content",
        "where content_id = #{contentId,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer contentId);

    @Insert({
        "insert into four_content (content_id, content_head, ",
        "content_uploader, content_upload_date, ",
        "content_people, commit_id, ",
        "content)",
        "values (#{contentId,jdbcType=INTEGER}, #{contentHead,jdbcType=VARCHAR}, ",
        "#{contentUploader,jdbcType=VARCHAR}, #{contentUploadDate,jdbcType=TIMESTAMP}, ",
        "#{contentPeople,jdbcType=INTEGER}, #{commitId,jdbcType=CHAR}, ",
        "#{content,jdbcType=LONGVARCHAR})"
    })
    /*@Options(useGeneratedKeys = true,keyProperty = "four_content.content_id")*/
    int insert(FourContent record);

    int insertSelective(FourContent record);

    @Select({
        "select",
        "content_id, content_head, content_uploader, content_upload_date, content_people, ",
        "commit_id, content",
        "from four_content",
        "where content_id = #{contentId,jdbcType=INTEGER}"
    })
    @ResultMap("com.meilele.dao.zhengchao.FourContentMapper.ResultMapWithBLOBs")
    FourContent selectByPrimaryKey(Integer contentId);

    int updateByPrimaryKeySelective(FourContent record);

    @Update({
        "update four_content",
        "set content_head = #{contentHead,jdbcType=VARCHAR},",
          "content_uploader = #{contentUploader,jdbcType=VARCHAR},",
          "content_upload_date = #{contentUploadDate,jdbcType=TIMESTAMP},",
          "content_people = #{contentPeople,jdbcType=INTEGER},",
          "commit_id = #{commitId,jdbcType=CHAR},",
          "content = #{content,jdbcType=LONGVARCHAR}",
        "where content_id = #{contentId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKeyWithBLOBs(FourContent record);

    @Update({
        "update four_content",
        "set content_head = #{contentHead,jdbcType=VARCHAR},",
          "content_uploader = #{contentUploader,jdbcType=VARCHAR},",
          "content_upload_date = #{contentUploadDate,jdbcType=TIMESTAMP},",
          "content_people = #{contentPeople,jdbcType=INTEGER},",
          "commit_id = #{commitId,jdbcType=CHAR}",
        "where content_id = #{contentId,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(FourContent record);
}